/*
    This source file is part of GeNa project.
    Copyright © GeNa project 2008
    For the latest info, see http://code.google.com/p/genaproject/ or  http://lumpyproject.forums-rpg.com

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    Foobar is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Foobar.  If not, see <http://www.gnu.org/licenses/>. */

#ifndef EDITOR_WINDOWMAIN_H_INCLUDED
#define EDITOR_WINDOWMAIN_H_INCLUDED

#ifndef WX_PCH_H_INCLUDED
#include "wx_pch.h"
#endif

#include <wx/frame.h>
#include <wx/aui/aui.h>

#include <boost/filesystem/operations.hpp>

#include <boost/archive/basic_archive.hpp>
#include <boost/serialization/base_object.hpp>
#include <boost/serialization/nvp.hpp>

#include "application.h"
#include "confwnd.h"

class MainFrame: public wxFrame
{
public:
    MainFrame(wxFrame *frame, const wxString& title);
    ~MainFrame();

    wxTextCtrl* m_logWnd;
    wxAuiManager* m_auiMgr;
    wxAuiNotebook* m_auiNotebook;

    wxLog* m_log;

    //Menu
    wxMenu* m_editMenu;

    //Toolbar
    wxToolBar* m_standard;

    enum
    {
        idMenuQuit = 1000,
        idMenuAbout,
        idMenuConfig,
        idMenuNew,
        idMenuOpen,
        idMenuSave,
        idMenuSaveAs,

        idMenuUndo,
        idMenuRedo
    };

    enum
    {
        //Resolution configuration menu
        idMenuRes1t64 = 1,
        idMenuRes2t64,
        idMenuRes4t64,
        idMenuRes8t64,
        idMenuRes16t64,
        idMenuRes32t64,
        idMenuRes64t4096,
        idMenuRes128t4096,
        idMenuRes512t4096,
        idMenuRes1024t4096,
        idMenuRes2048t4096,
        idMenuRes4096t262144,
        idMenuRes8192t262144,
        idMenuRes16384t262144
    };
private:
    ConfWindow* conf;

    void OnClose(wxCloseEvent& event);
    void OnQuit(wxCommandEvent& event);
    void OnAbout(wxCommandEvent& event);
    void OnSave(wxCommandEvent& event);
    void OnNew(wxCommandEvent& event);
    void OnOpen(wxCommandEvent& event);
    void OnConfiguration(wxCommandEvent &event);
    void OnUndo(wxCommandEvent &event);
    void OnRedo(wxCommandEvent &event);
    void OnResolution(wxCommandEvent &event);

    void OnPageChanged(wxAuiNotebookEvent& event);
    void OnPageClose(wxAuiNotebookEvent& event);
    DECLARE_EVENT_TABLE()

public:
    template<class Archive> void serialize(Archive & ar, const unsigned int version)
    {
        wxSize size = GetSize();
        ar & BOOST_SERIALIZATION_NVP(size);
        SetSize(size);
        //m_sizer->SetDimension(0,0,size.x, size.y);

    }
};


#endif // EDITOR_WINDOWMAIN_H_INCLUDED
